//
//  Detail.m
//  XDBaseFrameWork
//
//  Created by boyima on 14-10-22.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "Detail.h"

@implementation Detail

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self makeViews];
    }
    return self;
}

- (void)makeViews{
    
    _downView = [UIView initViewRect:CGRectMake(0, self.bounds.size.height/2, self.bounds.size.width, self.bounds.size.height/2) andBackGroudColor:UIColorFromRGB(0x919191)];
    [self addSubview:_downView];
    
    _titleLB = [UILabel initLabelText:@"专业" andRect:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height/2) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:12] andTextColor:UIColorFromRGB(0x919191) andTextAlignment:NSTextAlignmentCenter];
    [self addSubview:_titleLB];
    
    _scoreLB = [UILabel initLabelText:@"5.0" andRect:CGRectMake(0, self.bounds.size.height/2, self.bounds.size.width, self.bounds.size.height/2) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:14] andTextColor:[UIColor whiteColor] andTextAlignment:NSTextAlignmentCenter];
    [self addSubview:_scoreLB];
    
    self.backgroundColor = [UIColor clearColor];
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = 5;
    self.layer.borderWidth = 1;
    self.layer.borderColor = UIColorFromRGB(0x919191).CGColor;
}

- (void)initDataWithDict:(NSDictionary *)dict{
    _titleLB.text = dict[@"ItemName"];
    _scoreLB.text = dict[@"Avg"];
    if (_scoreLB.text.length > 3) {
        _scoreLB.font = [UIFont systemFontOfSize:13];
    }
}

@end
